package com.sunfeng.a01;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @Author : 孙峰
 * @Description:
 * @Date : 2022/4/7  11:39
 */
@Slf4j
@Component
@AllArgsConstructor
public class Component1 {


    private ApplicationEventPublisher applicationEventPublisher;

    public  void register(){
        log.info("用户注册");
        applicationEventPublisher.publishEvent(new UserRegisteredEvent(this));
    }

}
